package reno.eureka.timecycle.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reno.eureka.timecycle.entity.CetusExplainMO;
import reno.eureka.timecycle.entity.CycleMO;
import reno.eureka.timecycle.entity.PersistentCycleMO;

@RestController
public class CetusController {

    @RequestMapping("/getCetusCycle")
    public String getCetusCycle() {
        CycleMO cycleMO = PersistentCycleMO.getInstance().getCetusCycle();
        CetusExplainMO cetusExplainMO = new CetusExplainMO(cycleMO);

        String response = "[CURRVAL]，距离[NEXTVAL]还有[TIME]";
        response = response.replace("[CURRVAL]", cetusExplainMO.getCurrval());
        response = response.replace("[NEXTVAL]", cetusExplainMO.getNextval());
        response = response.replace("[TIME]", cetusExplainMO.getTimeString());
        String responseHead = "【测试版本】指挥官，Ordis检测到当前希图斯时间\n";
        return responseHead + response;
    }

}
